﻿using UnityEngine;
using UnityEngine.EventSystems;

namespace Component.UI.View
{
    public class RewardItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
    {
        [SerializeField] private RectTransform parent;
        
        private const float width = 100;
        
        public void OnPointerDown(PointerEventData eventData)
        {
            
        }

        public void OnPointerUp(PointerEventData eventData)
        {
            LeanTween.size(gameObject.GetComponent<RectTransform>(), new Vector2(100f, 100f), .3f);
            LeanTween.move(gameObject, parent.position, .3f).setOnComplete(delegate(object o)
            {
                transform.GetChild(0).gameObject.SetActive(false);
                transform.parent = parent;
            });
        }
    }
}